const User = require("../models/User")

/**
 * @description:注册
 * @param {*} username 用户名
 * @param {*} password 密码
 */
async function register(username, password) {
  const newUser = await User.create({ username, password })
  return newUser
}
/**
 * @description: 登录
 * @param {*} username
 * @param {*} password
 */
async function login(username, password) {
  const user = await User.findOne({ username, password })
  if (user != null) {
    return true
  }
  return false
}
module.exports = { register, login }
